<template>
<div class="modal-cover" v-show="isShow" :style="coverEnable?'width:100%;height:100%;':'width:'+width+';height:'+height+';'">
  <div class="modal" :style="'width:'+width+';height:'+height+';margin-top:'+marginTop+';'">
    <div class="modal-header" v-show="headerEnable">
      <div class="modal-title">
        <slot name="header">
          {{ title }}
        </slot>
      </div>
      <i class="iconfont icon-guanbi1 modal-close-btn" @click="hidden"></i>
    </div>
    <div class="modal-body">
      <slot></slot>
    </div>
  </div>
</div>
</template>
<script>
export default {
  data () {
    return { isShow: false }
  },
  props: {
    title: { type: String },
    width: { type: String, default: () => '70%' },
    height: { type: String, default: () => '60%' },
    marginTop: { type: String, default: () => '10%' },
    headerEnable: { type: Boolean, default: () => true },
    coverEnable: { type: Boolean, default: () => true }
  },
  methods: {
    show () {
      this.isShow = true
    },
    hidden () {
      this.isShow = false
    }
  }
}
</script>
